package cn.zyk.service;


import cn.zyk.config.ResourcePathConfig;

import java.lang.reflect.Constructor;

/**
 * @projectName: rocket-mq-springboot
 * @package: cn.zyk.service
 * @className: TestService
 * @author: Eric
 * @description: TODO
 * @date: 2025/9/27 13:12
 * @version: 1.0
 */
public class DatabaseTemplate {
    private DatabaseDriver databaseDriver;

    public DatabaseTemplate(ResourcePathConfig resourcePathConfig) throws Exception {
        String driver = resourcePathConfig.getDriver();
        Class<?> clazz = Class.forName(driver);
        Constructor<?> constructor = clazz.getDeclaredConstructor();
        this.databaseDriver = (DatabaseDriver) constructor.newInstance();
    }

    public void delete() {
        databaseDriver.delete();
    }
}
